package com.hfb.mashibing.alip8.juc.c011;

/**
 * 线程安全的单利模式
 *
 * 既不加锁，也可以实现线程安全的单利模式
 * @author HFB
 */
public class Singleton {

    private Singleton(){System.out.println("singleton");}

    private static class Inner{
        private static Singleton s = new Singleton();
    }

    public static Singleton getSingleton() {
      return Inner.s;
    }


    public static void main(String[] args) {
        Thread[] ts = new Thread[200];
    }
}
